<!-- 司机管理 -->
<template>
  <div class="dashboard-container driver customer-list-box">
    <div class="app-container">
      <el-card class="search-card-box" shadow="never">
        <el-form ref="goodsTypeSearchFromData" :model="goodsTypeSearchFromData" label-width="110px">
          <el-row :gutter="60">
            <el-col :span="8">
              <el-form-item label="货物类型名称:" style="margin-bottom: 0px">
                <el-input v-model="goodsTypeSearchFromData.name" placeholder="请输入货物类型名称" clearable/>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="运输车型:" style="margin-bottom: 0px" label-width="80px">
                <el-input v-model="goodsTypeSearchFromData.vehicleTypeName" placeholder="请输入运输车型名称" clearable/>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-button type="warning" @click="handleFilter">搜索</el-button>
              <el-button plain class="reset-btn" @click="resetForm('goodsTypeSearchFromData')">重置</el-button>
            </el-col>
          </el-row>
        </el-form>
      </el-card>
      <el-card v-loading="listLoading" element-loading-text="加载中" class="table-card-box"
        :class="{'table-empty-box': !dataList || dataList.length <= 0,'loading-box': listLoading}"
        shadow="never" style="margin-top: 20px">
        <el-button class="customer-add-btn" @click="handleAddGoodsType()">+ 新增货物类型</el-button>
        <el-table v-if="dataList && dataList.length > 0" :key="tableKey" ref="multipleTable" 
          :data="dataList" fit style="width: 100%" stripe :header-cell-style="{ background: 'rgba(250,252,255,1)' }"
          @selection-change="handleSelectionChange">
          <el-table-column align="center" type="index" label="序号" width="60">
            <template slot-scope="scope">
              <span>{{ scope.$index + (goodsTypeSearchFromData.page - 1) * goodsTypeSearchFromData.pageSize + 1}}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" label="货物类型编号" width="160px">
            <template slot-scope="scope">
              <span>{{ scope.row.id }}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" label="货物类型名称" width="160px">
            <template slot-scope="scope">
              <span> {{ scope.row.name }}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" label="运输车型" width="160px" class-name="transport-car">
            <template slot-scope="scope">
              <span>{{ scope.row.vehicleTypeName }}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" label="默认重量 (千克)" width="160px">
            <template slot-scope="scope">
              <span>{{ scope.row.defaultWeight }}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" label="默认体积 (立方)" width="160px">
            <template slot-scope="scope">
              <span>{{ scope.row.defaultVolume }}</span>
            </template>
          </el-table-column>
          <el-table-column align="center" label="说明">
            <template slot-scope="scope">
              <span>{{ scope.row.remark }}</span>
            </template>
          </el-table-column>
          <!-- 操作按钮 -->
          <el-table-column align="center" fixed="right" label="操作" width="110" class-name="small-padding fixed-width">
            <template slot-scope="scope">
              <el-link type="primary" :underline="false" @click="handleAddGoodsType(scope.row.id)">修改</el-link>
              <el-divider direction="vertical" />
              <el-link type="danger" :underline="false" @click="handleDelete(scope.row.id)">删除</el-link>
            </template>
          </el-table-column>
        </el-table>
        <empty v-else src="../../assets/empty.png" desc="这里空空如也~"></empty>
        <!-- end -->
        <!-- 分页 -->
        <div v-show="dataList && dataList.length > 0" class="pagination">
          <div class="pages">
            <el-pagination
              :current-page="Number(goodsTypeSearchFromData.pageNum)"
              :total="Number(total)"
              :page-size="Number(goodsTypeSearchFromData.pageSize)"
              :page-sizes="[10, 20, 30, 50]"
              layout="total, sizes, prev, pager, next, jumper"
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
            />
          </div>
        </div>
        <!-- end -->
        <goodsTypeModelsDialog ref="addGoodsType" class="add-form-dialog" :title-info="titleInfo" :form-base="formData" @newDataes="getList"/>
      </el-card>
    </div>
    <!-- 删除弹框重绘 -->
    <el-dialog class="customer-dialog" title="删除确认" :visible.sync="dialogVisible" width="394px" :before-close="handleClose">
      <img class="warn-img" src="@/assets/warn.png" alt=""/>
      <p>确认删除？</p>
      <span slot="footer" class="dialog-footer">
        <el-button class="confirm-btn" type="primary" @click="sumbitDelte">确定</el-button>
        <el-button class="cancel-btn" @click="dialogVisible = false">取消</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
export default {
  name: 'Courses'
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.alert {
  margin: 10px 0px;
}
.pagination {
  margin-top: 40px;
}
// 下拉框
::v-deep .el-select {
  width: 100%;
}

::v-deep .el-card{
  overflow: initial;
}
</style>

